import excel "\\cap\coombs\IPS1\redirections\u5390570\Desktop\German Service Record Data\Company Identifiers.xlsx", sheet("Sheet1") firstrow
rename Personalstamm_ID persid
duplicates report persid
rename EinheitStichprobe company

****Generating numeric company identifiers****

gen	company_id	=	1	if	company	==	"Stab 6. ID"
replace	company_id	=	2	if	company	==	"8./ IR 18"
replace	company_id	=	3	if	company	==	"13./ IR 37"
replace	company_id	=	4	if	company	==	"4./ AR 6"
replace	company_id	=	5	if	company	==	"3./ Pz.Jg.Abt.6"
replace	company_id	=	6	if	company	==	"1./ Nachr.Abt.6"
replace	company_id	=	7	if	company	==	"Feldgendarmerietrupp a. mot. 6"
replace	company_id	=	8	if	company	==	"11./ Sch. Rgt. 4"
replace	company_id	=	9	if	company	==	"1./ Pz. Rgt. 11"
replace	company_id	=	10	if	company	==	"2./ Pz. Rgt. 11"
replace	company_id	=	11	if	company	==	"3./ Pz. Rgt. 11"
replace	company_id	=	12	if	company	==	"6./ Pz. Rgt. 11"
replace	company_id	=	13	if	company	==	"8./ Pz. Rgt. 11"
replace	company_id	=	14	if	company	==	"1./ Pz. Jg. Abt. 41"
replace	company_id	=	15	if	company	==	"1./ IR 60"
replace	company_id	=	16	if	company	==	"9./ IR 60"
replace	company_id	=	17	if	company	==	"3./ IR 79"
replace	company_id	=	18	if	company	==	"9./ IR 64"
replace	company_id	=	19	if	company	==	"1./ Krad. Sch. Btl. 165"
replace	company_id	=	20	if	company	==	"3./ Sch. Rgt. 79"
replace	company_id	=	21	if	company	==	"9./ Sch. Rgt. 64"
replace	company_id	=	22	if	company	==	"11./ Sch. Rgt. 4"
replace	company_id	=	23	if	company	==	"1./Pz. GR 192"
replace	company_id	=	24	if	company	==	"5./IR 65"
replace	company_id	=	25	if	company	==	"3./ Pi. Btl. 26"
replace	company_id	=	26	if	company	==	"5./ GR 104"
replace	company_id	=	27	if	company	==	"10./ IR 193"
replace	company_id	=	28	if	company	==	"10./ GR 1052"
replace	company_id	=	29	if	company	==	"12./ GR 1058"
replace	company_id	=	30	if	company	==	"1./ AA 106"
replace	company_id	=	31	if	company	==	"1./ Pz. AA 116"
replace	company_id	=	32	if	company	==	"1./ AA 116"
replace	company_id	=	33	if	company	==	"1./ Pz. Jg. Abt. 233"
replace	company_id	=	34	if	company	==	"1./ AA 233"
replace	company_id	=	35	if	company	==	"Stab 211. ID"
replace	company_id	=	36	if	company	==	"Stab I. IR 317"
replace	company_id	=	37	if	company	==	"2./IR 317"
replace	company_id	=	38	if	company	==	"3./IR 317"
replace	company_id	=	39	if	company	==	"1./AR 211"
replace	company_id	=	40	if	company	==	"1./ Pz. Jg. Abt. 211"
replace	company_id	=	41	if	company	==	"2./ Nachr. Abt. 211"
replace	company_id	=	42	if	company	==	"San. Kp. 211"
replace	company_id	=	43	if	company	==	"8./ AR 227"
replace	company_id	=	44	if	company	==	"13./ IR 453"
replace	company_id	=	45	if	company	==	"1./ AR 361"
replace	company_id	=	46	if	company	==	"Stab I. AR 361"
replace	company_id	=	47	if	company	==	"11./ IR 671"
replace	company_id	=	48	if	company	==	"1./ Pz. Jg. Abt. 371"
replace	company_id	=	49	if	company	==	"6./ Sich.Reg. 360"
replace	company_id	=	50	if	company	==	"10./ IR 727"
replace	company_id	=	51	if	company	==	"1./ Baubataillon 85"
replace	company_id	=	52	if	company	==	"1./ Armee-Nachrichtenregiment 563"
replace	company_id	=	53	if	company	==	"Jagdkommando 6"
replace	company_id	=	54	if	company	==	"Stab Jagdkommando 6"
replace	company_id	=	55	if	company	==	"1./ Jagdkommando 6"
replace	company_id	=	56	if	company	==	"Flakregiment 4"
replace	company_id	=	57	if	company	==	"2./ Flakregiment 4"
replace	company_id	=	58	if	company	==	"7./ Flakregiment 4"
replace	company_id	=	59	if	company	==	"5./ Flakregiment 64"
replace	company_id	=	60	if	company	==	"3./ Technisches Bataillon 26"
replace	company_id	=	61	if	company	==	"5./ Landesschutzenbataillon VI"
replace	company_id	=	62	if	company	==	"Sturmgeschutzabteilung 1326"
replace	company_id	=	63	if	company	==	"Kommandant Ruckwartiges Armeegebiet 556"
replace	company_id	=	64	if	company	==	"Kommandant Ruckwartiges Armeegebiet 560"
replace	company_id	=	65	if	company	==	"1./ Wachbataillon 615"
replace	company_id	=	66	if	company	==	"Gruppe Geheime Feldpolizei 560"
replace	company_id	=	67	if	company	==	"2./ Reserve-Flughafen-Betriebskompanie VI"
replace	company_id	=	68	if	company	==	"3./ Reserve-Flughafen-Betriebskompanie VI"


***Generating numeric divisional identifiers****

gen	division_id	=	1	if	company	==	"Stab 6. ID"
replace	division_id	=	1	if	company	==	"8./ IR 18"
replace	division_id	=	1	if	company	==	"13./ IR 37"
replace	division_id	=	1	if	company	==	"4./ AR 6"
replace	division_id	=	1	if	company	==	"3./ Pz.Jg.Abt.6"
replace	division_id	=	1	if	company	==	"1./ Nachr.Abt.6"
replace	division_id	=	1	if	company	==	"Feldgendarmerietrupp a. mot. 6"
replace	division_id	=	2	if	company	==	"11./ Sch. Rgt. 4"
replace	division_id	=	2	if	company	==	"1./ Pz. Rgt. 11"
replace	division_id	=	2	if	company	==	"2./ Pz. Rgt. 11"
replace	division_id	=	2	if	company	==	"3./ Pz. Rgt. 11"
replace	division_id	=	2	if	company	==	"6./ Pz. Rgt. 11"
replace	division_id	=	2	if	company	==	"8./ Pz. Rgt. 11"
replace	division_id	=	2	if	company	==	"1./ Pz. Jg. Abt. 41"
replace	division_id	=	3	if	company	==	"1./ IR 60"
replace	division_id	=	3	if	company	==	"9./ IR 60"
replace	division_id	=	3	if	company	==	"3./ IR 79"
replace	division_id	=	3	if	company	==	"9./ IR 64"
replace	division_id	=	3	if	company	==	"1./ Krad. Sch. Btl. 165"
replace	division_id	=	4	if	company	==	"3./ Sch. Rgt. 79"
replace	division_id	=	4	if	company	==	"9./ Sch. Rgt. 64"
replace	division_id	=	4	if	company	==	"11./ Sch. Rgt. 4"
replace	division_id	=	5	if	company	==	"1./Pz. GR 192"
replace	division_id	=	6	if	company	==	"5./IR 65"
replace	division_id	=	7	if	company	==	"3./ Pi. Btl. 26"
replace	division_id	=	8	if	company	==	"5./ GR 104"
replace	division_id	=	9	if	company	==	"10./ IR 193"
replace	division_id	=	10	if	company	==	"10./ GR 1052"
replace	division_id	=	11	if	company	==	"12./ GR 1058"
replace	division_id	=	12	if	company	==	"1./ AA 106"
replace	division_id	=	13	if	company	==	"1./ Pz. AA 116"
replace	division_id	=	14	if	company	==	"1./ AA 116"
replace	division_id	=	15	if	company	==	"1./ Pz. Jg. Abt. 233"
replace	division_id	=	15	if	company	==	"1./ AA 233"
replace	division_id	=	16	if	company	==	"Stab 211. ID"
replace	division_id	=	16	if	company	==	"Stab I. IR 317"
replace	division_id	=	16	if	company	==	"2./IR 317"
replace	division_id	=	16	if	company	==	"3./IR 317"
replace	division_id	=	16	if	company	==	"1./AR 211"
replace	division_id	=	16	if	company	==	"1./ Pz. Jg. Abt. 211"
replace	division_id	=	16	if	company	==	"2./ Nachr. Abt. 211"
replace	division_id	=	16	if	company	==	"San. Kp. 211"
replace	division_id	=	17	if	company	==	"8./ AR 227"
replace	division_id	=	18	if	company	==	"13./ IR 453"
replace	division_id	=	19	if	company	==	"1./ AR 361"
replace	division_id	=	19	if	company	==	"Stab I. AR 361"
replace	division_id	=	20	if	company	==	"11./ IR 671"
replace	division_id	=	20	if	company	==	"1./ Pz. Jg. Abt. 371"
replace	division_id	=	21	if	company	==	"6./ Sich.Reg. 360"
replace	division_id	=	22	if	company	==	"10./ IR 727"
replace	division_id	=	23	if	company	==	"1./ Baubataillon 85"
replace	division_id	=	23	if	company	==	"1./ Armee-Nachrichtenregiment 563"
replace	division_id	=	23	if	company	==	"Jagdkommando 6"
replace	division_id	=	23	if	company	==	"Stab Jagdkommando 6"
replace	division_id	=	23	if	company	==	"1./ Jagdkommando 6"
replace	division_id	=	23	if	company	==	"Flakregiment 4"
replace	division_id	=	23	if	company	==	"2./ Flakregiment 4"
replace	division_id	=	23	if	company	==	"7./ Flakregiment 4"
replace	division_id	=	23	if	company	==	"5./ Flakregiment 64"
replace	division_id	=	23	if	company	==	"3./ Technisches Bataillon 26"
replace	division_id	=	23	if	company	==	"5./ Landesschutzenbataillon VI"
replace	division_id	=	23	if	company	==	"Sturmgeschutzabteilung 1326"
replace	division_id	=	23	if	company	==	"Kommandant Ruckwartiges Armeegebiet 556"
replace	division_id	=	23	if	company	==	"Kommandant Ruckwartiges Armeegebiet 560"
replace	division_id	=	23	if	company	==	"1./ Wachbataillon 615"
replace	division_id	=	23	if	company	==	"Gruppe Geheime Feldpolizei 560"
replace	division_id	=	23	if	company	==	"2./ Reserve-Flughafen-Betriebskompanie VI"
replace	division_id	=	23	if	company	==	"3./ Reserve-Flughafen-Betriebskompanie VI"

***Generating combattant/non-combattant dummies****

gen	combattant	=	0	if 	company_id	==	1
replace	combattant	=	1	if 	company_id	==	2
replace	combattant	=	1	if 	company_id	==	3
replace	combattant	=	1	if 	company_id	==	4
replace	combattant	=	1	if 	company_id	==	5
replace	combattant	=	0	if 	company_id	==	6
replace	combattant	=	0	if 	company_id	==	7
replace	combattant	=	1	if 	company_id	==	8
replace	combattant	=	1	if 	company_id	==	9
replace	combattant	=	1	if 	company_id	==	10
replace	combattant	=	1	if 	company_id	==	11
replace	combattant	=	1	if 	company_id	==	12
replace	combattant	=	1	if 	company_id	==	13
replace	combattant	=	1	if 	company_id	==	14
replace	combattant	=	1	if 	company_id	==	15
replace	combattant	=	1	if 	company_id	==	16
replace	combattant	=	1	if 	company_id	==	17
replace	combattant	=	1	if 	company_id	==	18
replace	combattant	=	1	if 	company_id	==	19
replace	combattant	=	1	if 	company_id	==	20
replace	combattant	=	1	if 	company_id	==	21
replace	combattant	=	1	if 	company_id	==	22
replace	combattant	=	1	if 	company_id	==	23
replace	combattant	=	1	if 	company_id	==	24
replace	combattant	=	0	if 	company_id	==	25
replace	combattant	=	1	if 	company_id	==	26
replace	combattant	=	1	if 	company_id	==	27
replace	combattant	=	1	if 	company_id	==	28
replace	combattant	=	1	if 	company_id	==	29
replace	combattant	=	0	if 	company_id	==	30
replace	combattant	=	1	if 	company_id	==	31
replace	combattant	=	0	if 	company_id	==	32
replace	combattant	=	1	if 	company_id	==	33
replace	combattant	=	0	if 	company_id	==	34
replace	combattant	=	0	if 	company_id	==	35
replace	combattant	=	0	if 	company_id	==	36
replace	combattant	=	1	if 	company_id	==	37
replace	combattant	=	1	if 	company_id	==	38
replace	combattant	=	1	if 	company_id	==	39
replace	combattant	=	1	if 	company_id	==	40
replace	combattant	=	0	if 	company_id	==	41
replace	combattant	=	0	if 	company_id	==	42
replace	combattant	=	1	if 	company_id	==	43
replace	combattant	=	1	if 	company_id	==	44
replace	combattant	=	1	if 	company_id	==	45
replace	combattant	=	0	if 	company_id	==	46
replace	combattant	=	1	if 	company_id	==	47
replace	combattant	=	1	if 	company_id	==	48
replace	combattant	=	1	if 	company_id	==	49
replace	combattant	=	1	if 	company_id	==	50
replace	combattant	=	0	if 	company_id	==	51
replace	combattant	=	0	if 	company_id	==	52
replace	combattant	=	1	if 	company_id	==	53
replace	combattant	=	0	if 	company_id	==	54
replace	combattant	=	1	if 	company_id	==	55
replace	combattant	=	1	if 	company_id	==	56
replace	combattant	=	1	if 	company_id	==	57
replace	combattant	=	1	if 	company_id	==	58
replace	combattant	=	1	if 	company_id	==	59
replace	combattant	=	0	if 	company_id	==	60
replace	combattant	=	1	if 	company_id	==	61
replace	combattant	=	1	if 	company_id	==	62
replace	combattant	=	0	if 	company_id	==	63
replace	combattant	=	0	if 	company_id	==	64
replace	combattant	=	0	if 	company_id	==	65
replace	combattant	=	0	if 	company_id	==	66
replace	combattant	=	0	if 	company_id	==	67
replace	combattant	=	0	if 	company_id	==	68

***Generating the "Months on the Eastern Front" Variable***

gen	mths_east	=	37	if	division_id	==	1
replace	mths_east	=	38	if	division_id	==	2
replace	mths_east	=	38	if	division_id	==	2
replace	mths_east	=	38	if	division_id	==	2
replace	mths_east	=	32	if	division_id	==	3
replace	mths_east	=	36	if	division_id	==	4
replace	mths_east	=	36	if	division_id	==	4
replace	mths_east	=	2	if	division_id	==	5
replace	mths_east	=	12	if	division_id	==	6
replace	mths_east	=	39	if	division_id	==	7
replace	mths_east	=	0	if	division_id	==	8
replace	mths_east	=	27	if	division_id	==	9
replace	mths_east	=	0	if	division_id	==	10
replace	mths_east	=	3	if	division_id	==	11
replace	mths_east	=	37	if	division_id	==	12
replace	mths_east	=	0	if	division_id	==	13
replace	mths_east	=	0	if	division_id	==	14
replace	mths_east	=	1	if	division_id	==	15
replace	mths_east	=	38	if	division_id	==	16
replace	mths_east	=	40	if	division_id	==	17
replace	mths_east	=	47	if	division_id	==	18
replace	mths_east	=	7	if	division_id	==	19
replace	mths_east	=	25	if	division_id	==	20
replace	mths_east	=	15	if	division_id	==	20
replace	mths_east	=	36	if	division_id	==	21
replace	mths_east	=	35	if	division_id	==	22


sort persid
by persid: egen tooth=mean(combattant)
by persid: egen eastern=mean(mths_east)


duplicates drop persid, force

keep persid tooth eastern

save "\\cap\coombs\IPS1\redirections\u5390570\Desktop\HJ Project\Tooth and Eastern Front Data.dta"







